<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "park_current_space".
 *
 * @property string $id
 * @property string $park_current_id
 * @property string $park_space_id
 *
 * @property ParkCurrent $parkCurrent
 */
class ParkCurrentSpace extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'park_current_space';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['id', 'park_current_id', 'park_space_id'], 'required'],
            [['id', 'park_current_id', 'park_space_id'], 'string', 'max' => 50],
            [['park_current_id'], 'exist', 'skipOnError' => true, 'targetClass' => ParkCurrent::className(), 'targetAttribute' => ['park_current_id' => 'id']],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '唯一标识',
            'park_current_id' => 'park_current标识',
            'park_space_id' => 'park_space标识',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getParkCurrent()
    {
        return $this->hasOne(ParkCurrent::className(), ['id' => 'park_current_id']);
    }
}
